Skip to content

test: cover SearchBarComponent debounce, cache, and routing#5237

Merged
aglinxinyuan merged 3 commits into
apache:mainfrom
Ma77Ball:test/searchBarSpec
May 27, 2026
Merged

test: cover SearchBarComponent debounce, cache, and routing#5237
aglinxinyuan merged 3 commits into
apache:mainfrom
Ma77Ball:test/searchBarSpec

Conversation

@Ma77Ball
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Added search-bar.component.spec.ts next to search-bar.component.ts with 11 cases covering every documented behavior of the component.
  • Covered isLogin initialization plus live updates from UserService.userChanged(), the empty-query clear path in onSearchInputChange, searchSubject debounce via fakeAsync + tick(200), the full SearchService.search argument list, per-query result caching, 20-entry cache eviction in addToCache, type dispatch in convertToName (workflow, project, file, dataset, plus the throw path), and performSearch navigation to DASHBOARD_SEARCH.
  • No production code changes.

Any related issues, documentation, or discussions?

Closes: #5228

How was this PR tested?

  • yarn ng test --watch=false --include "src/app/dashboard/component/user/search-bar/search-bar.component.spec.ts": 11 passed.

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.7 in compliance with ASF

@Ma77Ball Ma77Ball changed the title test(frontend): cover SearchBarComponent debounce, cache, and routing test: cover SearchBarComponent debounce, cache, and routing May 26, 2026
@Ma77Ball
Copy link
Copy Markdown
Contributor Author

/request-review @aglinxinyuan

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new unit test suite for SearchBarComponent to verify debounce behavior, caching/eviction, type-to-name conversion, login state tracking, and routing behavior as described in Issue #5228.

Changes:

  • Added search-bar.component.spec.ts with 11 test cases covering debounce, cache hits/eviction, and argument wiring to SearchService.search.
  • Added tests for isLogin initialization/updates, empty-query clearing behavior, convertToName dispatch + throw path, and performSearch routing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/app/dashboard/component/user/search-bar/search-bar.component.spec.ts Outdated
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label May 27, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.68%. Comparing base (d5bc8b7) to head (a008cfc).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5237      +/-   ##
============================================
- Coverage     48.72%   48.68%   -0.05%     
- Complexity     2375     2379       +4     
============================================
  Files          1044     1042       -2     
  Lines         40096    39971     -125     
  Branches       4252     4252              
============================================
- Hits          19538    19460      -78     
+ Misses        19411    19366      -45     
+ Partials       1147     1145       -2     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 8a7366f
agent-service 33.76% <ø> (ø) Carriedforward from 8a7366f
amber 51.58% <ø> (+0.02%) ⬆️ Carriedforward from 8a7366f
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 8a7366f
config-service 0.00% <ø> (ø) Carriedforward from 8a7366f
file-service 37.99% <ø> (ø) Carriedforward from 8a7366f
frontend 40.30% <ø> (+0.27%) ⬆️
python 90.46% <ø> (-0.34%) ⬇️ Carriedforward from 8a7366f
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 8a7366f

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aglinxinyuan aglinxinyuan enabled auto-merge May 27, 2026 04:51
@aglinxinyuan aglinxinyuan added this pull request to the merge queue May 27, 2026
Merged via the queue into apache:main with commit 968144b May 27, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add spec coverage for search-bar.component.ts

4 participants